package com.allqj;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;

/**
 * @author sjw
 * @className FileIO
 * @date 2021/11/11 8:22
 * @description: TODO
 */
public class FileIO {
    public static void main(String[] args) throws IOException {
        FileChannel fileChannel=new RandomAccessFile(new File("G:\\io.txt"),"rw").getChannel();
        MappedByteBuffer mappedByteBuffer=fileChannel.map(FileChannel.MapMode.READ_WRITE,0,1000);
        byte[] data=new byte[4];
        int position=8;
        mappedByteBuffer.put(data);
        fileChannel.close();
    }
}
